<?php
include("../config.inc.php");
global $conexion;
//----------------------------------------------------
// The use of the data sent from the Javascript side is enabled.
//----------------------------------------------------
$data = array();

$db_table    = mysql_escape_string($_GET['db_table']);
$q_word      = mysql_escape_string($_GET['q_word']);
$field       = mysql_escape_string($_GET['field']);
$primary_key = mysql_escape_string($_GET['primary_key']);
$where = ((isset($_GET['where'])) ? $_GET['where'] : "" );


//----------------------------------------------------
// connect data base
//----------------------------------------------------
//$db = sqlite_open('../SQLite2/test.sqlite','0600');


//----------------------------------------------------
// get initialize value
//----------------------------------------------------
$query = "

	SELECT   $field
	FROM     $db_table
	WHERE    $primary_key = '$q_word'

";


if ($where != "") {$query.= " AND " . $where;}
//echo $query;
$rows  = mysql_query($query,$conexion);
$row = mysql_fetch_array($rows,MYSQL_NUM);
for ($x=0;$x<count($row);$x++){
	echo utf8_encode($row[$x]).",";}

//----------------------------------------------------
// End
//----------------------------------------------------
// cut the connection with the data base
//sqlite_close($db);

?>
